package org.testile.datasetgenerifier.impl;

import java.util.HashMap;
import java.util.Map;
import org.testile.datasetgenerifier.DatasetGenerifier;
import org.testile.datasetgenerifier.TableGenerifier;

/**
 *
 * @author ytoh
 */
public class DefaultDatasetGenerifier implements DatasetGenerifier {
	private Map<String, TableGenerifier> tableGenerifiers;

	public DefaultDatasetGenerifier() {
		this.tableGenerifiers = new HashMap<String, TableGenerifier>();
	}

	public DefaultDatasetGenerifier(Map<String, TableGenerifier> tableGenerifiers) {
		this.tableGenerifiers = tableGenerifiers;
	}

	public void addTableGenerifier(String tableName, TableGenerifier generifier) {
		tableGenerifiers.put(tableName, generifier);
	}

	public TableGenerifier getTableGenerifier(String tableName) {
		TableGenerifier tableGenerifier = tableGenerifiers.get(tableName);

		if(tableGenerifier == null) {
			tableGenerifier = new DefaultTableGenerifier();
			tableGenerifiers.put(tableName, tableGenerifier);
		}

		return tableGenerifier;
	}
}
